<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => assert_selection(
    '<div contenteditable>|hello</div>',
    'insertText c',
    '<div contenteditable>c|hello</div>'),
    'insert text into DIV with some text');

test(() => assert_selection(
    '<div contenteditable>|</div>',
    'insertText c',
    '<div contenteditable>c|</div>'),
    'insert text into completely empty DIV');

test(() => assert_selection(
    '<div contenteditable>|\n</div>',
    'insertText c',
    '<div contenteditable>c|\n</div>'),
    'insert text into DIV with collapsable whitespace');

test(() => assert_selection(
    '<div contenteditable style="min-height: 20px">|<p></p></div>',
    'insertText c',
    '<div contenteditable style="min-height: 20px">c|<p></p></div>'),
    'insert text into DIV with empty P');

test(() => assert_selection(
    '<div contenteditable style="min-height: 20px">|\n<p></p>\n</div>',
    'insertText c',
    '<div contenteditable style="min-height: 20px">c|\n<p></p>\n</div>'),
    'insert text into DIV with empty P with collapsable whitespace');
</script>
